if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_GetAllOrderDetailsByOrderID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_GetAllOrderDetailsByOrderID]
GO
CREATE PROC sp_GetAllOrderDetailsByOrderID
	@orderID	int
AS
BEGIN
	SELECT A.ID, A.OrderID, A.ProductID, A.Number, A.Price, A.Value, B.ProductName, C.Discount
		FROM OrderDetails As A INNER JOIN Product As B ON A.ProductID = B.ID
			LEFT JOIN OrderRequest C ON A.OrderID = C.ID
		WHERE A.OrderID = @orderID
		ORDER BY B.ProductName
END

SELECT * FROM OrderRequest